﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SubSonic;
using System.Data;
using Classes;

namespace AvaliacaoWeb
{
    public partial class SelecionaAvaliacao : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                // Campos Selecionados
                String sql = " SELECT a_idava.titulo, a_idava.datalim, a_idava.numava From a_avaliacao " +
                                " INNER JOIN a_idava On  " +
                                    " a_idava.numava = a_avaliacao.numava" +
                                 " INNER JOIN a_avaliador " +
                                    " ON  a_avaliador.numava = a_avaliacao.numava" +
                                    " AND a_avaliador.Matric = " + Session["Matric"].ToString() +
                             " WHERE a_avaliacao.Matric = " + Session["Matric"].ToString() +
                                " AND a_avaliador.flgava = ''" +
                                " AND STR_TO_DATE(datalim, '%d/%m/%Y') >= NOW()" +
                             " GROUP BY a_idava.numava ";

                QueryCommand qryCommandBoleti = new QueryCommand(sql.ToString(), "Default");
                DataSet ds = DataService.GetDataSet(qryCommandBoleti);

                dtGrid.DataSource = ds.Tables[0];
                dtGrid.DataBind();
            }
        }

        protected void dtGrid_RowDataBound(object sender, GridViewRowEventArgs e)
        {

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Cells[2].Attributes.Add("onclick", "document.getElementById('imgCarregando').style.display='block'; return true;");                                
            }


        }

    }
}